<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <style>
      :root {
        --border-width: 40px;
        --harf-border-width: calc(var(--border-width) / 2);
      }
      .trangle {
        width: 0;
        height: 0;
        border-width: var(--border-width);
        border-color: transparent transparent transparent red; /*上右下左 右边是三角形*/
        border-style: dashed solid dashed dashed; /*上右下左 右边是三角形, 兼容 IE 这么写 border-style:dashed solid dashed dashed， 否则直接写border-style: solid;  */
        overflow: hidden; /* 兼容 IE 加上吧*/
        transform: rotate(0deg) translateX(var(--harf-border-width));
        transition: transform linear 0.3s;
      }
      .rotate:hover {
        cursor: pointer;
        transform: rotate(90deg) translateX(var(--harf-border-width));
      }
    </style>
    <div class="trangle rotate"></div>
  </body>
</html>
